package br.com.documentos.model.persistence;

import java.util.List;

import org.hibernate.SessionFactory;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import br.com.documentos.model.entity.TipoDocumentoPadrao;

@Repository
public class TipoDocumentoPadraoRepository extends BaseRepository<TipoDocumentoPadrao> {
	
	@Autowired
	public void init(SessionFactory factory) {
	    setSessionFactory(factory);
	}

	public List<TipoDocumentoPadrao> buscarTiposDocumentoAtivos(){
		return list( createCriteria()
						.add( Restrictions.eq("ativo",true) )
						.addOrder(Order.asc("nome")));
	}

}
